home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-serious-
/
misc
/
football
/
user
/
viewnextweeksschedule.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-11-29
|
9KB
|
317 lines
/* Mode=Run */
/* ***********************************************************************
VIEW NEXT WEEKS SCHEDULE PROGRAM FOR FOOTBALL REXX SUITE
----------------------------------------------------------
Copyright Mark Naughton 1997
Version Date History
--------------------------------------------------------------------------
1.0 071097 First release.
151297 Tidied display.
250899 Added error msg to file checks.
110999 Converted to use locale. Some error messages, before
reading the locale, will still be in English.
Converted to use a global date format file. Now correctly
translates date format to get required data.
190999 Changed schedule directory.
**************************************************************************
Procedure
---------
1. Check files exist. Read Teams.df datafile and store league name. Check
for autoscheduled.
2. If league has not been autoscheduled then give an error and quit.
3. Open AutoSchedule file and find the type.
4. Set range for the dates.
5. Display the header.
6. Open '.sf' file. Search for matches played during the next week...
7. If Weeks, if a match is found then display the formatted data. But
when a new week is found, goto (9).
8. If Dates, format the date from the line read from the file and if
it is within the two dates, format the data and display.
9. When the file is finished, print the number of matches and exit...
************************************************************************** */
PARSE ARG league_stuff
version = 1
input_file = '.df'
input2_file = '.sf'
title = '*LEAGUE_NAME='
autosched = '*AUTOSCHD='
separator = '*'
not_played = '__ __'
months = "January February March April May June July August September October November December"
parse var league_stuff league_file
league_file = "Data/" || league_file
addlib('rexxsupport.library',0,-30,0)
if open(datafile,"Data/Football.locale",'r') then do
line = readln(datafile)
locdir = strip(line)
close(datafile)
end
else do
say
say "ERROR : (ViewNextWeeksSchedule)"
say
say "Cannot read 'Data/Football.locale' for the locale settings."
exit
end
dfordir = locdir"Football.locale_data"
locdir = locdir"User/ViewNextWeeksSchedule.data"
if open(datafile,"ENV:FootballRXPath",'r') then do
line = readln(datafile)
rxdir = strip(line)
close(datafile)
end
else
rxdir = "SYS:Rexxc/"
if exists(locdir) > 0 then do
address command rxdir'rx 'locdir
VarCount = getclip('VarCount')
do i = 1 to VarCount
interpret getclip('var.'i)
end
end
else do
say
say "ERROR : (ViewNextWeeksSchedule)"
say
say "Cannot find '"locdir"' to read locale settings."
exit
end
if exists(dfordir) > 0 then do
address command rxdir'rx 'dfordir
VarCount = getclip('VarCount')
do i = 1 to VarCount
interpret getclip('var.'i)
end
end
else do
say
say "ERROR : (ViewNextWeeksSchedule)"
say
say "Cannot find '"dfordir"' to read date locale settings."
exit
end
if exists(league_file || input_file) = 0 then do
say
say vnws_error
say
say vnws_t1"'"league_file || input_file"'."
exit
end
if exists(league_file || input2_file) = 0 then do
say
say vnws_error
say
say vnws_t1"'"league_file || input2_file"'."
exit
end
autos = 0
if open(datafile,league_file || input_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(title,line) > 0 then
league_title = delstr(line,1,13)
if pos(autosched,line) > 0 then do
autofile = delstr(line,1,10)
autos = 1
end
end
close(datafile)
end
else do
say
say vnws_error
say
say vnws_t2"'"league_file || input_file"'"vnws_t3
exit
end
if autos = 0 then do
say
say vnws_error
say
say vnws_t4
say
say vnws_t5
say vnws_t6
say "'Teams6.schd'. "vnws_t7
say
exit
end
type = 0
if autos = 1 then do
if open(datafile,"Data/Schedules/"||autofile||".schd",'r') then do
line = readln(datafile)
if pos("*WEEKS",line) > 0 then
type = 10
if pos("*DATES",line) > 0 then
type = 20
close(datafile)
end
else do
say
say vnws_error
say
say vnws_t8" 'Data/Schedules/"autofile".schd' "vnws_t9
exit
end
end
start_date = date('i')
end_date = start_date + 6
say
say center(vnws_t10" '"league_title"'",78)
say "-------------------------------------------------------------------------------"
say
say vnws_t11" '"autofile"' "vnws_t12
say
say
if type=10 then
say vnws_t13
else
say vnws_t14" "date('n',start_date,'i')" "vnws_t15" "date('n',end_date,'i')"."
say
matches = 0
s_l = 0
if open(datafile,league_file || input2_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(separator,line) > 0 then do
if pos("*Week:",line) > 0 then do
curr = 10
if matches > 0 then
leave
end
if pos("*Date:",line) > 0 then do
if s_l = 0 then do
parse var line "*Date:" dateall
search_loc = strip(word(dateall,words(dateall)-1))
do mnls=1 to 12
if pos(word(months,mnls),search_loc) > 0 then do
s_l = 1
leave
end
end
if s_l = 0 then do
locale_cats = showdir("Locale/")
do search_locale=1 to words(locale_cats)
dfordir = "Locale/"word(locale_cats,search_locale)"/Football.locale_data"
if exists(dfordir) > 0 then do
address command rxdir'rx 'dfordir
VarCount = getclip('VarCount')
do i = 1 to VarCount
interpret getclip('var.'i)
end
end
parse var line "*Date:" dateall
search_loc = strip(word(dateall,words(dateall)-1))
do mnls=1 to 12
if pos(word(months,mnls),search_loc) > 0 then do
s_l = 1
leave
end
end
if s_l = 1 then leave
end
end
if s_l > 0 then do
temp_dtal = dateall
parse var date_format "day" sp1 "number" sp2 "month" sp3 "year"
parse var line "*Date:" dateall
do i=1 to 7
if pos(word(days,i),dateall) > 0 then do
lk = pos(word(days,i),dateall)
dateall = delstr(dateall,1,lk+length(word(days,i))+length(sp1)-1)
end
end
dateall = strip(dateall)
year = word(dateall,words(dateall))
mnth = strip(word(dateall,words(dateall)-1))
do lm=1 to length(mnth)
if datatype(substr(mnth,1,1),'m') ~= 1 then
mnth = delstr(mnth,1,1)
end
dateall = temp_dtal
day = word(dateall,2)
do lm=1 to length(day)-2
if datatype(substr(day,3,1),'n') ~= 1 then
day = delstr(day,3,1)
end
cv = 0
do i=1 to 12
if pos(word(months,i),mnth) > 0 then do
cv = i
leave
end
end
end
end
if s_l = 0 then do
say
say vnws_error
say
say vnws_t18
exit
end
curr = 0
/*
year = word(line,5)
mnth = word(line,4)
day = word(line,3)
*/
curd = trim(year)||right(cv,2,0)||right(day,2,0)
s_l = 0
if start_date <= date('i',curd,'s') & end_date >= date('i',curd,'s') then
curr = 10
end
end
if curr = 10 then do
if pos(separator,line) = 0 then do
if pos(not_played,line) > 0 then do
home_team = strip(substr(line,1,35))
away_team = strip(substr(line,41,35))
say left(home_team,30)""txt_versus""away_team
matches = matches + 1
end
end
end
end
close(datafile)
say
if matches = 0 then
say vnws_t16
else
say vnws_t17": "matches
say
say "-------------------------------------------------------------------------------"
say
end
else do
say
say vnws_error
say
say vnws_t8"'"league_file || input2_file"'."
end
exit